% 计算1+3+5+7+…+(2n+1)的值
n = input('输入n的值:');
sum = 0;
for i = 1:n
    sum = sum + 2*i -1;
end
sum
